﻿using CCWin;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TelephoneYiShou;

namespace gongyingshang
{
    public partial class addSupplier : Skin_Mac
    {
        public addSupplier()
        {
            InitializeComponent();
        }

        private void addbtn_Click(object sender, EventArgs e)
        {
            string supplierid = Supplieridtxt.Text;
            string suppliername = SupplierNametxt.Text;
            string adderss = Addersstxt.Text;
            string email = Emailtxt.Text;
            string phone = Phonetxt.Text;
            string lnkman = Lnkmantxt.Text;
            string bankid = BankIDtxt.Text;
            if (string.IsNullOrEmpty(supplierid)||string.IsNullOrEmpty(suppliername) ||
                string.IsNullOrEmpty(adderss) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(phone)
                || string.IsNullOrEmpty(lnkman) || string.IsNullOrEmpty(bankid))
            {
                MessageBox.Show("信息输入不完整！");
                return;//直接返回
            }
            string sql = string.Format("insert into Supplier Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')",supplierid,suppliername, adderss,
                email,phone,lnkman,bankid);
            if (DBHelper.ExecuteNonQuery(sql))
            {
                MessageBoxEx.Show("商品信息添加成功！");
            }
            else
            {
                MessageBoxEx.Show("添加失败,请联系管理员!");
            }
        }

        private void clearbtn_Click(object sender, EventArgs e)
        {
            this.Supplieridtxt.Text = "";
            this.SupplierNametxt.Text = "";
            this.Addersstxt.Text = "";
            this.BankIDtxt.Text = "";
            this.Phonetxt.Text = "";
            this.Lnkmantxt.Text = "";
            this.Emailtxt.Text = "";
        }

        private void exitbtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void addSupplier_Load(object sender, EventArgs e)
        {

        }
    }
}
